
#ifndef CHARACTER_H
#define CHARACTER_H

#include<QGraphicsItem>
#include<QTimer>
#include<QObject>
#include<QMediaPlayer>
#include<QAudioOutput>


class Character:public QObject
{
public:
    Character();
    QGraphicsPixmapItem* pose;
    bool dest=1;
    int moveflag=0;
    bool meetflag=0;
    int width;
    int height;
    int health;
    int damage;
    static int attackflag;
    QTimer* attackTimer;
    static int jumpAddition;
    static int moveAddition;
    QMediaPlayer* attack1;
    QMediaPlayer* attack2;
    QMediaPlayer* attack3;
    QMediaPlayer* attack4;
    QMediaPlayer* attack5;
    QMediaPlayer* beattack;
    QMediaPlayer* fail;
    QAudioOutput* attackoutput;

    QRectF boundingRect() const
    {
        if(this->attackflag>1)
            return QRectF(pose->x()-50,pose->y(),pose->x()+width,pose->y()+height);
        else
            return QRectF(pose->x(),pose->y(),pose->x()+width,pose->y()+height);
    }

    void attack();
    void beAttacked();

};

#endif // CHARACTER_H
